package com.moguhoutai.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.moguhoutai.biz.CustomerBiz;
import com.moguhoutai.model.Customer;


@Controller
@RequestMapping("/customer")
public class CustomerController {
@Resource
 private CustomerBiz customerBiz;

@RequestMapping("/list")
	public String list (Map<String, Object>request){
		try {
			long count = customerBiz.findCount();
			List<Customer> list = customerBiz.findAll();
			request.put("totalCount", count);
			request.put("list", list);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "/customer/list";
	}


@RequestMapping("/listshow")
	public String customer (String name,Map<String, Object>request){
		try {
			System.out.println("------------------->");
			Customer customer = customerBiz.findByName(name);
			request.put("list", customer);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "/customer/listshow";
	}
}
